<?php
class Wow_Armory_Parse_Result
{
    
    public function __construct(Array $results)
    {
        foreach ($results as $name => $item) {
            $this->$name = $item;
        }
    }
    
    /**
     * Adds a new result.
     * 
     * @param  Wow_Armory_Core_Handler_Abstract $handler
     * @return Wow_Armory_Parse_Result
     */
    public function addResult(Wow_Armory_Core_Handler_Abstract $handler)
    {
        $name = get_class($handler);
        $this->$name = $handler;
        return $this;
    }
    
    /**
     * Gets a result.
     * 
     * @param  string $name
     * @return Wow_Armory_Core_Handler_Abstract
     */
    public function getResult($name)
    {
        if (isset($this->$name)) {
            return $this->$name;
        }
        
        return null;
    }
    
}